﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lizk.SimpleHUD;

namespace SharpMedia.Input
{
    public partial class KeyInputForm : Form
    {
        public KeyboardBinding<HUDCommands> Binding { get; set; }

        public KeyInputForm(KeyboardBinding<HUDCommands> binding)
        {
            this.Binding = binding;
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void KeyInputForm_KeyUp(object sender, KeyEventArgs e)
        {
            Keys modifiers = Keys.None;
            if (e.Alt) modifiers |= Keys.Alt;
            if (e.Control) modifiers |= Keys.Control;
            if (e.Shift) modifiers |= Keys.Shift;

            Binding.AssignKey(e.KeyCode, modifiers);
            e.Handled = true;
            this.Close();


        }

    }
}
